<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>Charts</title>
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'css/bootstrap.min.css', _external = True) }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename = 'css/demo.css', _external = True) }}">
</head>
<body>

<ol id="cataLog" class="catalog"></ol>

<div id="demo" style="margin: 0 auto"></div>

<script type="text/javascript" src="{{ url_for('static', filename = 'js/libs/jquery-1.12.0.min.js', _external = True) }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename = 'js/catalog.js', _external = True) }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename = 'js/echarts.js', _external = True) }}"></script>

<script type="text/javascript">
    $(function () {
        $('#demo').height(window.innerHeight).width(window.innerWidth * 0.5);
        initDemo();
    });

    var initDemo = function () {
        var option = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {            // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                data: ['利润', '支出', '收入']
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'value'
                }
            ],
            yAxis: [
                {
                    type: 'category',
                    axisTick: {show: false},
                    data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
                }
            ],
            series: [
                {
                    name: '利润',
                    type: 'bar',
                    label: {
                        normal: {
                            show: true,
                            position: 'inside'
                        }
                    },
                    data: [200, 170, 240, 244, 200, 220, 210]
                },
                {
                    name: '收入',
                    type: 'bar',
                    stack: '总量',
                    label: {
                        normal: {
                            show: true
                        }
                    },
                    data: [320, 302, 341, 374, 390, 450, 420]
                },
                {
                    name: '支出',
                    type: 'bar',
                    stack: '总量',
                    label: {
                        normal: {
                            show: true,
                            position: 'left'
                        }
                    },
                    data: [-120, -132, -101, -134, -190, -230, -210]
                }
            ]
        };
        var myChart = echarts.init(document.getElementById('demo'));
        myChart.setOption(option);
    }
</script>
</body>
</html>